<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/corelib/io/qurl.cpp -->
<head>
  <title>Qt 4.3: QUrl Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QUrl Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1>
<p>The QUrl class provides a convenient interface for working with URLs. <a href="#details">More...</a></p>
<pre> #include &lt;QUrl&gt;</pre><p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qurl-members.html">List of all members, including inherited members</a></li>
<li><a href="qurl-obsolete.html">Obsolete members</a></li>
<li><a href="qurl-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qurl.html#FormattingOption-enum">FormattingOption</a></b> { None, RemoveScheme, RemovePassword, RemoveUserInfo, ..., StripTrailingSlash }</li>
<li><div class="fn"/>flags <b><a href="qurl.html#FormattingOption-enum">FormattingOptions</a></b></li>
<li><div class="fn"/>enum <b><a href="qurl.html#ParsingMode-enum">ParsingMode</a></b> { TolerantMode, StrictMode }</li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qurl.html#QUrl">QUrl</a></b> ()</li>
<li><div class="fn"/><b><a href="qurl.html#QUrl-2">QUrl</a></b> ( const QString &amp; <i>url</i> )</li>
<li><div class="fn"/><b><a href="qurl.html#QUrl-3">QUrl</a></b> ( const QUrl &amp; <i>other</i> )</li>
<li><div class="fn"/><b><a href="qurl.html#QUrl-4">QUrl</a></b> ( const QString &amp; <i>url</i>, ParsingMode <i>parsingMode</i> )</li>
<li><div class="fn"/><b><a href="qurl.html#dtor.QUrl">~QUrl</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qurl.html#addQueryItem">addQueryItem</a></b> ( const QString &amp; <i>key</i>, const QString &amp; <i>value</i> )</li>
<li><div class="fn"/>QStringList <b><a href="qurl.html#allQueryItemValues">allQueryItemValues</a></b> ( const QString &amp; <i>key</i> ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#authority">authority</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qurl.html#clear">clear</a></b> ()</li>
<li><div class="fn"/>QByteArray <b><a href="qurl.html#encodedQuery">encodedQuery</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#errorString">errorString</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#fragment">fragment</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#hasFragment">hasFragment</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#hasQuery">hasQuery</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#hasQueryItem">hasQueryItem</a></b> ( const QString &amp; <i>key</i> ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#host">host</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#isEmpty">isEmpty</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#isParentOf">isParentOf</a></b> ( const QUrl &amp; <i>childUrl</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#isRelative">isRelative</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#isValid">isValid</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#password">password</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#path">path</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qurl.html#port">port</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qurl.html#port-2">port</a></b> ( int <i>defaultPort</i> ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#queryItemValue">queryItemValue</a></b> ( const QString &amp; <i>key</i> ) const</li>
<li><div class="fn"/>QList&lt;QPair&lt;QString, QString&gt; &gt; <b><a href="qurl.html#queryItems">queryItems</a></b> () const</li>
<li><div class="fn"/>char <b><a href="qurl.html#queryPairDelimiter">queryPairDelimiter</a></b> () const</li>
<li><div class="fn"/>char <b><a href="qurl.html#queryValueDelimiter">queryValueDelimiter</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a></b> ( const QString &amp; <i>key</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#removeQueryItem">removeQueryItem</a></b> ( const QString &amp; <i>key</i> )</li>
<li><div class="fn"/>QUrl <b><a href="qurl.html#resolved">resolved</a></b> ( const QUrl &amp; <i>relative</i> ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#scheme">scheme</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qurl.html#setAuthority">setAuthority</a></b> ( const QString &amp; <i>authority</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setEncodedQuery">setEncodedQuery</a></b> ( const QByteArray &amp; <i>query</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setEncodedUrl">setEncodedUrl</a></b> ( const QByteArray &amp; <i>encodedUrl</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setEncodedUrl-2">setEncodedUrl</a></b> ( const QByteArray &amp; <i>encodedUrl</i>, ParsingMode <i>parsingMode</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setFragment">setFragment</a></b> ( const QString &amp; <i>fragment</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setHost">setHost</a></b> ( const QString &amp; <i>host</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setPassword">setPassword</a></b> ( const QString &amp; <i>password</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setPath">setPath</a></b> ( const QString &amp; <i>path</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setPort">setPort</a></b> ( int <i>port</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a></b> ( char <i>valueDelimiter</i>, char <i>pairDelimiter</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setQueryItems">setQueryItems</a></b> ( const QList&lt;QPair&lt;QString, QString&gt; &gt; &amp; <i>query</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setScheme">setScheme</a></b> ( const QString &amp; <i>scheme</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setUrl">setUrl</a></b> ( const QString &amp; <i>url</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setUrl-2">setUrl</a></b> ( const QString &amp; <i>url</i>, ParsingMode <i>parsingMode</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setUserInfo">setUserInfo</a></b> ( const QString &amp; <i>userInfo</i> )</li>
<li><div class="fn"/>void <b><a href="qurl.html#setUserName">setUserName</a></b> ( const QString &amp; <i>userName</i> )</li>
<li><div class="fn"/>QByteArray <b><a href="qurl.html#toEncoded">toEncoded</a></b> ( FormattingOptions <i>options</i> = None ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#toLocalFile">toLocalFile</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#toString">toString</a></b> ( FormattingOptions <i>options</i> = None ) const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#userInfo">userInfo</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qurl.html#userName">userName</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qurl.html#operator-not-eq">operator!=</a></b> ( const QUrl &amp; <i>url</i> ) const</li>
<li><div class="fn"/>QUrl &amp; <b><a href="qurl.html#operator-eq">operator=</a></b> ( const QUrl &amp; <i>url</i> )</li>
<li><div class="fn"/>QUrl &amp; <b><a href="qurl.html#operator-eq-2">operator=</a></b> ( const QString &amp; <i>url</i> )</li>
<li><div class="fn"/>bool <b><a href="qurl.html#operator-eq-eq">operator==</a></b> ( const QUrl &amp; <i>url</i> ) const</li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</h3>
<ul>
<li><div class="fn"/>QString <b><a href="qurl.html#fromAce">fromAce</a></b> ( const QByteArray &amp; <i>domain</i> )</li>
<li><div class="fn"/>QUrl <b><a href="qurl.html#fromEncoded">fromEncoded</a></b> ( const QByteArray &amp; <i>input</i> )</li>
<li><div class="fn"/>QUrl <b><a href="qurl.html#fromEncoded-2">fromEncoded</a></b> ( const QByteArray &amp; <i>input</i>, ParsingMode <i>parsingMode</i> )</li>
<li><div class="fn"/>QUrl <b><a href="qurl.html#fromLocalFile">fromLocalFile</a></b> ( const QString &amp; <i>localFile</i> )</li>
<li><div class="fn"/>QString <b><a href="qurl.html#fromPercentEncoding">fromPercentEncoding</a></b> ( const QByteArray &amp; <i>input</i> )</li>
<li><div class="fn"/>QStringList <b><a href="qurl.html#idnWhitelist">idnWhitelist</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a></b> ( const QStringList &amp; <i>list</i> )</li>
<li><div class="fn"/>QByteArray <b><a href="qurl.html#toAce">toAce</a></b> ( const QString &amp; <i>domain</i> )</li>
<li><div class="fn"/>QByteArray <b><a href="qurl.html#toPercentEncoding">toPercentEncoding</a></b> ( const QString &amp; <i>input</i>, const QByteArray &amp; <i>exclude</i> = QByteArray(), const QByteArray &amp; <i>include</i> = QByteArray() )</li>
</ul>
<a name="related-non-members"></a>
<h3>Related Non-Members</h3>
<ul>
<li><div class="fn"/>QDataStream &amp; <b><a href="qurl.html#operator-lt-lt-17">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>out</i>, const QUrl &amp; <i>url</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qurl.html#operator-gt-gt-13">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>in</i>, QUrl &amp; <i>url</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QUrl class provides a convenient interface for working with URLs.</p>
<p>It can parse and construct URLs in both encoded and unencoded form. QUrl also has support for internationalized domain names (IDNs).</p>
<p>The most common way to use QUrl is to initialize it via the constructor by passing a <a href="qstring.html">QString</a>. Otherwise, <a href="qurl.html#setUrl">setUrl</a>() and <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>() can also be used.</p>
<p>URLs can be represented in two forms: encoded or unencoded. The unencoded representation is suitable for showing to users, but the encoded representation is typically what you would send to a web server. For example, the unencoded URL &quot;http://b&uuml;<tt></tt>hler.example.com&quot; would be sent to the server as &quot;http://xn--bhler-kva.example.com/List%20of%20applicants.xml&quot;.</p>
<p>A URL can also be constructed piece by piece by calling <a href="qurl.html#setScheme">setScheme</a>(), <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#setPassword">setPassword</a>(), <a href="qurl.html#setHost">setHost</a>(), <a href="qurl.html#setPort">setPort</a>(), <a href="qurl.html#setPath">setPath</a>(), <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>() and <a href="qurl.html#setFragment">setFragment</a>(). Some convenience functions are also available: <a href="qurl.html#setAuthority">setAuthority</a>() sets the user name, password, host and port. <a href="qurl.html#setUserInfo">setUserInfo</a>() sets the user name and password at once.</p>
<p>Call <a href="qurl.html#isValid">isValid</a>() to check if the URL is valid. This can be done at any point during the constructing of a URL.</p>
<p>Constructing a query is particularly convenient through the use of <a href="qurl.html#setQueryItems">setQueryItems</a>(), <a href="qurl.html#addQueryItem">addQueryItem</a>() and <a href="qurl.html#removeQueryItem">removeQueryItem</a>(). Use <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>() to customize the delimiters used for generating the query string.</p>
<p>For the convenience of generating encoded URL strings or query strings, there are two static functions called <a href="qurl.html#fromPercentEncoding">fromPercentEncoding</a>() and <a href="qurl.html#toPercentEncoding">toPercentEncoding</a>() which deal with percent encoding and decoding of QStrings.</p>
<p>Calling <a href="qurl.html#isRelative">isRelative</a>() will tell whether or not the URL is relative. A relative URL can be resolved by passing it as argument to <a href="qurl.html#resolved">resolved</a>(), which returns an absolute URL. <a href="qurl.html#isParentOf">isParentOf</a>() is used for determining whether one URL is a parent of another.</p>
<p><a href="qurl.html#fromLocalFile">fromLocalFile</a>() constructs a QUrl by parsing a local file path. <a href="qurl.html#toLocalFile">toLocalFile</a>() converts a URL to a local file path.</p>
<p>The human readable representation of the URL is fetched with <a href="qurl.html#toString">toString</a>(). This representation is appropriate for displaying a URL to a user in unencoded form. The encoded form however, as returned by <a href="qurl.html#toEncoded">toEncoded</a>(), is for internal use, passing to web servers, mail clients and so on.</p>
<p>QUrl conforms to the URI specification from <a href="http://www.rfc-editor.org/rfc/rfc3986.txt">RFC 3986</a> (Uniform Resource Identifier: Generic Syntax), and includes scheme extensions from <a href="http://www.rfc-editor.org/rfc/rfc1738.txt">RFC 1738</a> (Uniform Resource Locators).</p>
<p>See also <a href="qurlinfo.html">QUrlInfo</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="flags"><a name="FormattingOption-enum"></a>enum QUrl::FormattingOption<br />flags QUrl::FormattingOptions</h3>
<p>The formatting options define how the URL is formatted when written out as text.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QUrl::None</tt></td><td align="center" valign="top"><tt>0x0</tt></td><td valign="top">The URL is left unchanged.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveScheme</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">The scheme is removed from the URL.</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePassword</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">Any password in the URL is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveUserInfo</tt></td><td align="center" valign="top"><tt>RemovePassword | 0x4</tt></td><td valign="top">Any user information in the URL is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePort</tt></td><td align="center" valign="top"><tt>0x8</tt></td><td valign="top">Any specified port is removed from the URL.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveAuthority</tt></td><td align="center" valign="top"><tt>RemoveUserInfo | RemovePort | 0x10</tt></td><td valign="top">&nbsp;</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePath</tt></td><td align="center" valign="top"><tt>0x20</tt></td><td valign="top">The URL's path is removed, leaving only the scheme, host address, and port (if present).</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveQuery</tt></td><td align="center" valign="top"><tt>0x40</tt></td><td valign="top">The query part of the URL (following a '?' character) is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveFragment</tt></td><td align="center" valign="top"><tt>0x80</tt></td><td valign="top">&nbsp;</td></tr>
<tr><td valign="top"><tt>QUrl::StripTrailingSlash</tt></td><td align="center" valign="top"><tt>0x10000</tt></td><td valign="top">The trailing slash is removed if one is present.</td></tr>
</table></p>
<p>The FormattingOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;FormattingOption&gt;. It stores an OR combination of FormattingOption values.</p>
<h3 class="fn"><a name="ParsingMode-enum"></a>enum QUrl::ParsingMode</h3>
<p>The parsing mode controls the way <a href="qurl.html">QUrl</a> parses strings.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QUrl::TolerantMode</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top"><a href="qurl.html">QUrl</a> will try to correct some common errors in URLs. This mode is useful when processing URLs entered by users.</td></tr>
<tr><td valign="top"><tt>QUrl::StrictMode</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Only valid URLs are accepted. This mode is useful for general URL validation.</td></tr>
</table></p>
<p>In TolerantMode, the parser corrects the following invalid input:</p>
<ul>
<li>Spaces and &quot;%20&quot;: If an encoded URL contains a space, this will be replaced with &quot;%20&quot;. If a decoded URL contains &quot;%20&quot;, this will be replaced with a single space before the URL is parsed.</li>
<li>Single &quot;%&quot; characters: Any occurrences of a percent character &quot;%&quot; not followed by exactly two hexadecimal characters (e.g&#x2e;, &quot;13% coverage.html&quot;) will be replaced by &quot;%25&quot;.</li>
<li>Non-US-ASCII characters: An encoded URL should only contain US-ASCII characters. In TolerantMode, characters outside this range are automatically percent-encoded.</li>
<li>Any occurrence of &quot;[&quot; and &quot;]&quot; following the host part of the URL is percent-encoded.</li>
</ul>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QUrl"></a>QUrl::QUrl ()</h3>
<p>Constructs an empty <a href="qurl.html">QUrl</a> object.</p>
<h3 class="fn"><a name="QUrl-2"></a>QUrl::QUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>Constructs a URL by parsing <i>url</i>. <i>url</i> is assumed to be in human readable representation, with no percent encoding. <a href="qurl.html">QUrl</a> will automatically percent encode all characters that are not allowed in a URL.</p>
<p>Example:</p>
<pre> QUrl url(&quot;http:<span class="comment">//</span>www.example.com/List of holidays.xml&quot;);
<span class="comment"> //</span> url.toEncoded() == &quot;http:<span class="comment">//</span>www.example.com/List%20of%20holidays.xml&quot;</pre>
<p>To construct a URL from an encoded string, call <a href="qurl.html#fromEncoded">fromEncoded</a>():</p>
<pre> QUrl url = QUrl::fromEncoded(&quot;http:<span class="comment">//</span>www.trolltech.com/List%20of%20holidays.xml&quot;);</pre>
<p>See also <a href="qurl.html#setUrl">setUrl</a>(), <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>(), <a href="qurl.html#fromEncoded">fromEncoded</a>(), and <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<h3 class="fn"><a name="QUrl-3"></a>QUrl::QUrl ( const QUrl &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<h3 class="fn"><a name="QUrl-4"></a>QUrl::QUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>Parses the <i>url</i> using the parser mode <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="dtor.QUrl"></a>QUrl::~QUrl ()</h3>
<p>Destructor; called immediately before the object is deleted.</p>
<h3 class="fn"><a name="addQueryItem"></a>void QUrl::addQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i>, const <a href="qstring.html">QString</a> &amp; <i>value</i> )</h3>
<p>Inserts the pair <i>key</i> = <i>value</i> into the query string of the URL.</p>
<h3 class="fn"><a name="allQueryItemValues"></a><a href="qstringlist.html">QStringList</a> QUrl::allQueryItemValues ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns the a list of query string values whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#queryItemValue">queryItemValue</a>().</p>
<h3 class="fn"><a name="authority"></a><a href="qstring.html">QString</a> QUrl::authority () const</h3>
<p>Returns the authority of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<h3 class="fn"><a name="clear"></a>void QUrl::clear ()</h3>
<p>Resets the content of the <a href="qurl.html">QUrl</a>. After calling this function, the <a href="qurl.html">QUrl</a> is equal to one that has been constructed with the default empty constructor.</p>
<h3 class="fn"><a name="encodedQuery"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedQuery () const</h3>
<p>Returns the query string of the URL in percent encoded form.</p>
<p>See also <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>
<h3 class="fn"><a name="errorString"></a><a href="qstring.html">QString</a> QUrl::errorString () const</h3>
<p>Returns a text string that explains why an URL is invalid in the case being; otherwise returns an empty string.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="fragment"></a><a href="qstring.html">QString</a> QUrl::fragment () const</h3>
<p>Returns the fragment of the URL.</p>
<p>See also <a href="qurl.html#setFragment">setFragment</a>().</p>
<h3 class="fn"><a name="fromAce"></a><a href="qstring.html">QString</a> QUrl::fromAce ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>domain</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the Unicode form of the given domain name <i>domain</i>, which is encoded in the ASCII Compatible Encoding (ACE). The result of this function is considered equivalent to <i>domain</i>.</p>
<p>If the value in <i>domain</i> cannot be encoded, it will be converted to <a href="qstring.html">QString</a> and returned.</p>
<p>The ASCII Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491 and RFC 3492. It is part of the Internationalizing Domain Names in Applications (IDNA) specification, which allows for domain names (like <tt>&quot;www.trolltech.com&quot;</tt>) to be written using international characters.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="fromEncoded"></a>QUrl QUrl::fromEncoded ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Parses <i>input</i> and returns the corresponding <a href="qurl.html">QUrl</a>. <i>input</i> is assumed to be in encoded form, containing only ASCII characters.</p>
<p>The URL is parsed using <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<p>See also <a href="qurl.html#toEncoded">toEncoded</a>() and <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="fromEncoded-2"></a>QUrl QUrl::fromEncoded ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Parses the URL using <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#toEncoded">toEncoded</a>() and <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="fromLocalFile"></a>QUrl QUrl::fromLocalFile ( const <a href="qstring.html">QString</a> &amp; <i>localFile</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns a <a href="qurl.html">QUrl</a> representation of <i>localFile</i>, interpreted as a local file.</p>
<p>See also <a href="qurl.html#toLocalFile">toLocalFile</a>().</p>
<h3 class="fn"><a name="fromPercentEncoding"></a><a href="qstring.html">QString</a> QUrl::fromPercentEncoding ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns a decoded copy of <i>input</i>. <i>input</i> is first decoded from percent encoding, then converted from UTF-8 to unicode.</p>
<h3 class="fn"><a name="hasFragment"></a>bool QUrl::hasFragment () const</h3>
<p>Returns true if this URL contains a fragment (i.e&#x2e;, if # was seen on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#fragment">fragment</a>() and <a href="qurl.html#setFragment">setFragment</a>().</p>
<h3 class="fn"><a name="hasQuery"></a>bool QUrl::hasQuery () const</h3>
<p>Returns true if this URL contains a Query (i.e&#x2e;, if ? was seen on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#hasQueryItem">hasQueryItem</a>() and <a href="qurl.html#encodedQuery">encodedQuery</a>().</p>
<h3 class="fn"><a name="hasQueryItem"></a>bool QUrl::hasQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns true if there is a query string pair whose key is equal to <i>key</i> from the URL.</p>
<h3 class="fn"><a name="host"></a><a href="qstring.html">QString</a> QUrl::host () const</h3>
<p>Returns the host of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setHost">setHost</a>().</p>
<h3 class="fn"><a name="idnWhitelist"></a><a href="qstringlist.html">QStringList</a> QUrl::idnWhitelist ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.</p>
<p>See <a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a>() for the rationale of this list.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a>().</p>
<h3 class="fn"><a name="isEmpty"></a>bool QUrl::isEmpty () const</h3>
<p>Returns true if the URL has no data; otherwise returns false.</p>
<h3 class="fn"><a name="isParentOf"></a>bool QUrl::isParentOf ( const QUrl &amp; <i>childUrl</i> ) const</h3>
<p>Returns true if this URL is a parent of <i>childUrl</i>. <i>childUrl</i> is a child of this URL if the two URLs share the same scheme and authority, and this URL's path is a parent of the path of <i>childUrl</i>.</p>
<h3 class="fn"><a name="isRelative"></a>bool QUrl::isRelative () const</h3>
<p>Returns true if the URL is relative; otherwise returns false. A URL is relative if its scheme is undefined; this function is therefore equivalent to calling <a href="qurl.html#scheme">scheme</a>().<a href="qurl.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="isValid"></a>bool QUrl::isValid () const</h3>
<p>Returns true if the URL is valid; otherwise returns false.</p>
<p>The URL is run through a conformance test. Every part of the URL must conform to the standard encoding rules of the URI standard for the URL to be reported as valid.</p>
<pre> bool checkUrl(const QUrl &amp;url) {
     if (!url.isValid()) {
         qDebug(QString(&quot;Invalid URL: %1&quot;).arg(url.toString()));
         return false;
     }

     return true;
 }</pre>
<h3 class="fn"><a name="password"></a><a href="qstring.html">QString</a> QUrl::password () const</h3>
<p>Returns the password of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setPassword">setPassword</a>() and <a href="qurl.html#setUserName">setUserName</a>().</p>
<h3 class="fn"><a name="path"></a><a href="qstring.html">QString</a> QUrl::path () const</h3>
<p>Returns the path of the URL.</p>
<p>See also <a href="qurl.html#setPath">setPath</a>().</p>
<h3 class="fn"><a name="port"></a>int QUrl::port () const</h3>
<p>Returns the port of the URL, or -1 if the port is unspecified.</p>
<p>See also <a href="qurl.html#setPort">setPort</a>().</p>
<h3 class="fn"><a name="port-2"></a>int QUrl::port ( int <i>defaultPort</i> ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the port of the URL, or <i>defaultPort</i> if the port is unspecified.</p>
<p>Example:</p>
<pre> QFtp ftp;
 ftp.connectToHost(url.host(), url.port(21));</pre>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="queryItemValue"></a><a href="qstring.html">QString</a> QUrl::queryItemValue ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns the first query string value whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>().</p>
<h3 class="fn"><a name="queryItems"></a><a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qstring.html">QString</a>, <a href="qstring.html">QString</a>&gt; &gt; QUrl::queryItems () const</h3>
<p>Returns the query string of the URL, as a map of keys and values.</p>
<p>See also <a href="qurl.html#setQueryItems">setQueryItems</a>() and <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>
<h3 class="fn"><a name="queryPairDelimiter"></a>char QUrl::queryPairDelimiter () const</h3>
<p>Returns the character used to delimit between key-value pairs in the query string of the URL.</p>
<h3 class="fn"><a name="queryValueDelimiter"></a>char QUrl::queryValueDelimiter () const</h3>
<p>Returns the character used to delimit between keys and values in the query string of the URL.</p>
<h3 class="fn"><a name="removeAllQueryItems"></a>void QUrl::removeAllQueryItems ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )</h3>
<p>Removes all the query string pairs whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#removeQueryItem">removeQueryItem</a>().</p>
<h3 class="fn"><a name="removeQueryItem"></a>void QUrl::removeQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )</h3>
<p>Removes the first query string pair whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a>().</p>
<h3 class="fn"><a name="resolved"></a>QUrl QUrl::resolved ( const QUrl &amp; <i>relative</i> ) const</h3>
<p>Returns the result of the merge of this URL with <i>relative</i>. This URL is used as a base to convert <i>relative</i> to an absolute URL.</p>
<p>If <i>relative</i> is not a relative URL, this function will return <i>relative</i> directly. Otherwise, the paths of the two URLs are merged, and the new URL returned has the scheme and authority of the base URL, but with the merged path, as in the following example:</p>
<pre> QUrl baseUrl(&quot;http:<span class="comment">//</span>www.trolltech.com/support&quot;);
 QUrl relativeUrl(&quot;../products/solutions&quot;);
 qDebug(baseUrl.resolved(relativeUrl).toString());
<span class="comment"> //</span> prints &quot;http:<span class="comment">//</span>www.trolltech.com/products/solutions&quot;</pre>
<p>Calling resolved() with &quot;..&quot; returns a <a href="qurl.html">QUrl</a> whose directory is one level higher than the original. Similarly, calling resolved() with &quot;../&#x2e;.&quot; removes two levels from the path. If <i>relative</i> is &quot;/&quot;, the path becomes &quot;/&quot;.</p>
<p>See also <a href="qurl.html#isRelative">isRelative</a>().</p>
<h3 class="fn"><a name="scheme"></a><a href="qstring.html">QString</a> QUrl::scheme () const</h3>
<p>Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.</p>
<p>See also <a href="qurl.html#setScheme">setScheme</a>() and <a href="qurl.html#isRelative">isRelative</a>().</p>
<h3 class="fn"><a name="setAuthority"></a>void QUrl::setAuthority ( const <a href="qstring.html">QString</a> &amp; <i>authority</i> )</h3>
<p>Sets the authority of the URL to <i>authority</i>.</p>
<p>The authority of a URL is the combination of user info, a host name and a port. All of these elements are optional; an empty authority is therefore valid.</p>
<p>The user info and host are separated by a '<a href="mailto:@">@</a>', and the host and port are separated by a ':'. If the user info is empty, the '<a href="mailto:@">@</a>' must be omitted; although a stray ':' is permitted if the port is empty.</p>
<p>The following example shows a valid authority string:</p>
<p align="center"><img src="images/qurl-authority.png" /></p><p>See also <a href="qurl.html#authority">authority</a>().</p>
<h3 class="fn"><a name="setEncodedQuery"></a>void QUrl::setEncodedQuery ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>query</i> )</h3>
<p>Sets the query string of the URL to <i>query</i>. The string is inserted as-is, and no further encoding is performed when calling <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>This function is useful if you need to pass a query string that does not fit into the key-value pattern, or that uses a different scheme for encoding special characters than what is suggested by <a href="qurl.html">QUrl</a>.</p>
<p>Passing a value of QByteArray() to <i>query</i> (a null <a href="qbytearray.html">QByteArray</a>) unsets the query completely. However, passing a value of <a href="qbytearray.html">QByteArray</a>(&quot;&quot;) will set the query to an empty value, as if the original URL had a lone &quot;?&quot;.</p>
<p>See also <a href="qurl.html#encodedQuery">encodedQuery</a>() and <a href="qurl.html#hasQuery">hasQuery</a>().</p>
<h3 class="fn"><a name="setEncodedUrl"></a>void QUrl::setEncodedUrl ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>encodedUrl</i> )</h3>
<p>Constructs a URL by parsing the contents of <i>encodedUrl</i>.</p>
<p><i>encodedUrl</i> is assumed to be a URL string in percent encoded form, containing only ASCII characters.</p>
<p>Use <a href="qurl.html#isValid">isValid</a>() to determine if a valid URL was constructed.</p>
<p>See also <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="setEncodedUrl-2"></a>void QUrl::setEncodedUrl ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>encodedUrl</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Constructs a URL by parsing the contents of <i>encodedUrl</i> using the given <i>parsingMode</i>.</p>
<h3 class="fn"><a name="setFragment"></a>void QUrl::setFragment ( const <a href="qstring.html">QString</a> &amp; <i>fragment</i> )</h3>
<p>Sets the fragment of the URL to <i>fragment</i>. The fragment is the last part of the URL, represented by a '#' followed by a string of characters. It is typically used in HTTP for referring to a certain link or point on a page:</p>
<p align="center"><img src="images/qurl-fragment.png" /></p><p>The fragment is sometimes also referred to as the URL &quot;reference&quot;.</p>
<p>Passing an argument of QString() (a null <a href="qstring.html">QString</a>) will unset the fragment. Passing an argument of <a href="qstring.html">QString</a>(&quot;&quot;) (an empty but not null <a href="qstring.html">QString</a>) will set the fragment to an empty string (as if the original URL had a lone &quot;#&quot;).</p>
<p>See also <a href="qurl.html#fragment">fragment</a>() and <a href="qurl.html#hasFragment">hasFragment</a>().</p>
<h3 class="fn"><a name="setHost"></a>void QUrl::setHost ( const <a href="qstring.html">QString</a> &amp; <i>host</i> )</h3>
<p>Sets the host of the URL to <i>host</i>. The host is part of the authority.</p>
<p>See also <a href="qurl.html#host">host</a>() and <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<h3 class="fn"><a name="setIdnWhitelist"></a>void QUrl::setIdnWhitelist ( const <a href="qstringlist.html">QStringList</a> &amp; <i>list</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have non-ASCII characters in domains to the value of <i>list</i>.</p>
<p>Qt has comes a default list that contains the Internet top-level domains that have published support for Internationalized Domain Names (IDNs) and rules to guarantee that no deception can happen between similarly-looking characters (such as the Latin lowercase letter <tt>'a'</tt> and the Cyrillic equivalent, which in most fonts are visually identical).</p>
<p>This list is periodically maintained, as registrars publish new rules.</p>
<p>This function is provided for those who need to manipulate the list, in order to add or remove a TLD. It is not recommended to change its value for purposes other than testing, as it may expose users to security risks.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#idnWhitelist">idnWhitelist</a>().</p>
<h3 class="fn"><a name="setPassword"></a>void QUrl::setPassword ( const <a href="qstring.html">QString</a> &amp; <i>password</i> )</h3>
<p>Sets the URL's password to <i>password</i>. The <i>password</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>See also <a href="qurl.html#password">password</a>() and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<h3 class="fn"><a name="setPath"></a>void QUrl::setPath ( const <a href="qstring.html">QString</a> &amp; <i>path</i> )</h3>
<p>Sets the path of the URL to <i>path</i>. The path is the part of the URL that comes after the authority but before the query string.</p>
<p align="center"><img src="images/qurl-ftppath.png" /></p><p>For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example:</p>
<p align="center"><img src="images/qurl-mailtopath.png" /></p><p>See also <a href="qurl.html#path">path</a>().</p>
<h3 class="fn"><a name="setPort"></a>void QUrl::setPort ( int <i>port</i> )</h3>
<p>Sets the port of the URL to <i>port</i>. The port is part of the authority of the URL, as described in <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<p><i>port</i> must be between 0 and 65535 inclusive. Setting the port to -1 indicates that the port is unspecified.</p>
<p>See also <a href="qurl.html#port">port</a>().</p>
<h3 class="fn"><a name="setQueryDelimiters"></a>void QUrl::setQueryDelimiters ( char <i>valueDelimiter</i>, char <i>pairDelimiter</i> )</h3>
<p>Sets the characters used for delimiting between keys and values, and between key-value pairs in the URL's query string. The default value delimiter is '=' and the default pair delimiter is '&amp;'.</p>
<p align="center"><img src="images/qurl-querystring.png" /></p><p><i>valueDelimiter</i> will be used for separating keys from values, and <i>pairDelimiter</i> will be used to separate key-value pairs. Any occurrences of these delimiting characters in the encoded representation of the keys and values of the query string are percent encoded.</p>
<p>If <i>valueDelimiter</i> is set to '-' and <i>pairDelimiter</i> is '/', the above query string would instead be represented like this:</p>
<pre> http:<span class="comment">//</span>www.example.com/cgi-bin/drawgraph.cgi?type-pie/color-green</pre>
<p>Calling this function does not change the delimiters of the current query string. It only affects <a href="qurl.html#queryItems">queryItems</a>(), <a href="qurl.html#setQueryItems">setQueryItems</a>() and addQueryItems().</p>
<h3 class="fn"><a name="setQueryItems"></a>void QUrl::setQueryItems ( const <a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qstring.html">QString</a>, <a href="qstring.html">QString</a>&gt; &gt; &amp; <i>query</i> )</h3>
<p>Sets the query string of the URL to an encoded version of <i>query</i>. The contents of <i>query</i> are converted to a string internally, each pair delimited by the character returned by pairDelimiter(), and the key and value are delimited by valueDelimiter().</p>
<p>See also <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>() and <a href="qurl.html#queryItems">queryItems</a>().</p>
<h3 class="fn"><a name="setScheme"></a>void QUrl::setScheme ( const <a href="qstring.html">QString</a> &amp; <i>scheme</i> )</h3>
<p>Sets the scheme of the URL to <i>scheme</i>. As a scheme can only contain ASCII characters, no conversion or encoding is done on the input.</p>
<p>The scheme describes the type (or protocol) of the URL. It's represented by one or more ASCII characters at the start the URL, and is followed by a ':'. The following example shows a URL where the scheme is &quot;ftp&quot;:</p>
<p align="center"><img src="images/qurl-authority2.png" /></p><p>The scheme can also be empty, in which case the URL is interpreted as relative.</p>
<p>See also <a href="qurl.html#scheme">scheme</a>() and <a href="qurl.html#isRelative">isRelative</a>().</p>
<h3 class="fn"><a name="setUrl"></a>void QUrl::setUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>Constructs a URL by parsing the contents of <i>url</i>.</p>
<p><i>url</i> is assumed to be in unicode format, with no percent encoding.</p>
<p>Calling <a href="qurl.html#isValid">isValid</a>() will tell whether or not a valid URL was constructed.</p>
<p>See also <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>
<h3 class="fn"><a name="setUrl-2"></a>void QUrl::setUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Parses <i>url</i> using the parsing mode <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>
<h3 class="fn"><a name="setUserInfo"></a>void QUrl::setUserInfo ( const <a href="qstring.html">QString</a> &amp; <i>userInfo</i> )</h3>
<p>Sets the user info of the URL to <i>userInfo</i>. The user info is an optional part of the authority of the URL, as described in <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<p>The user info consists of a user name and optionally a password, separated by a ':'. If the password is empty, the colon must be omitted. The following example shows a valid user info string:</p>
<p align="center"><img src="images/qurl-authority3.png" /></p><p>See also <a href="qurl.html#userInfo">userInfo</a>(), <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#setPassword">setPassword</a>(), and <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<h3 class="fn"><a name="setUserName"></a>void QUrl::setUserName ( const <a href="qstring.html">QString</a> &amp; <i>userName</i> )</h3>
<p>Sets the URL's user name to <i>userName</i>. The <i>userName</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>See also <a href="qurl.html#userName">userName</a>() and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<h3 class="fn"><a name="toAce"></a><a href="qbytearray.html">QByteArray</a> QUrl::toAce ( const <a href="qstring.html">QString</a> &amp; <i>domain</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the ASCII Compatible Encoding of the given domain name <i>domain</i>. The result of this function is considered equivalent to <i>domain</i>.</p>
<p>The ASCII-Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491 and RFC 3492. It is part of the Internationalizing Domain Names in Applications (IDNA) specification, which allows for domain names (like <tt>&quot;www.trolltech.com&quot;</tt>) to be written using international characters.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="toEncoded"></a><a href="qbytearray.html">QByteArray</a> QUrl::toEncoded ( <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> <i>options</i> = None ) const</h3>
<p>Returns the encoded representation of the URL if it's valid; otherwise an empty <a href="qbytearray.html">QByteArray</a> is returned. The output can be customized by passing flags with <i>options</i>.</p>
<p>The user info, path and fragment are all converted to UTF-8, and all non-ASCII characters are then percent encoded. The host name is encoded using Punycode.</p>
<h3 class="fn"><a name="toLocalFile"></a><a href="qstring.html">QString</a> QUrl::toLocalFile () const</h3>
<p>Returns the path of this URL formatted as a local file path.</p>
<p>See also <a href="qurl.html#fromLocalFile">fromLocalFile</a>().</p>
<h3 class="fn"><a name="toPercentEncoding"></a><a href="qbytearray.html">QByteArray</a> QUrl::toPercentEncoding ( const <a href="qstring.html">QString</a> &amp; <i>input</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>exclude</i> = QByteArray(), const <a href="qbytearray.html">QByteArray</a> &amp; <i>include</i> = QByteArray() )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns an encoded copy of <i>input</i>. <i>input</i> is first converted to UTF-8, and all ASCII-characters that are not in the unreserved group are percent encoded. To prevent characters from being percent encoded pass them to <i>exclude</i>. To force characters to be percent encoded pass them to <i>include</i>.</p>
<p>Unreserved is defined as: ALPHA / DIGIT / &quot;-&quot; / &quot;.&quot; / &quot;_&quot; / &quot;~&quot;</p>
<pre> QByteArray ba = QUrl::toPercentEncoding(&quot;{a fishy string?}&quot;, &quot;{}&quot;, &quot;s&quot;);
 qDebug(ba.constData());
<span class="comment"> //</span> prints &quot;{a fi%73hy %73tring%3F}&quot;</pre>
<h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> QUrl::toString ( <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> <i>options</i> = None ) const</h3>
<p>Returns the human-displayable string representation of the URL. The output can be customized by passing flags with <i>options</i>.</p>
<p>See also <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> and <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<h3 class="fn"><a name="userInfo"></a><a href="qstring.html">QString</a> QUrl::userInfo () const</h3>
<p>Returns the user info of the URL, or an empty string if the user info is undefined.</p>
<p>See also <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<h3 class="fn"><a name="userName"></a><a href="qstring.html">QString</a> QUrl::userName () const</h3>
<p>Returns the user name of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setUserName">setUserName</a>().</p>
<h3 class="fn"><a name="operator-not-eq"></a>bool QUrl::operator!= ( const QUrl &amp; <i>url</i> ) const</h3>
<p>Returns true if this URL and the given <i>url</i> are not equal; otherwise returns false.</p>
<h3 class="fn"><a name="operator-eq"></a>QUrl &amp; QUrl::operator= ( const QUrl &amp; <i>url</i> )</h3>
<p>Assigns the specified <i>url</i> to this object.</p>
<h3 class="fn"><a name="operator-eq-2"></a>QUrl &amp; QUrl::operator= ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Assigns the specified <i>url</i> to this object.</p>
<h3 class="fn"><a name="operator-eq-eq"></a>bool QUrl::operator== ( const QUrl &amp; <i>url</i> ) const</h3>
<p>Returns true if this URL and the given <i>url</i> are equal; otherwise returns false.</p>
<hr />
<h2>Related Non-Members</h2>
<h3 class="fn"><a name="operator-lt-lt-17"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>out</i>, const QUrl &amp; <i>url</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Writes url <i>url</i> to the stream <i>out</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
<h3 class="fn"><a name="operator-gt-gt-13"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>in</i>, QUrl &amp; <i>url</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Reads a url into <i>url</i> from the stream <i>in</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
